import {defineStore} from 'pinia'
import { reqHospitalDetail ,reqDepartmentDetail} from '@/api/hospital';
import {HosPitalDetail,DepartmentArr} from '@/api/hospital/type'
const useDetailStore=defineStore('Detail',{
    state: ()=>{
        return{
            // 医院详情的数据
            hospitalInfo:({} as HosPitalDetail),
            departmentInfo:({} as DepartmentArr)
        }
    },
    actions:{
        // 获取医院详情方法
        async getHospital(hoscode:any){
          let res:any=  await reqHospitalDetail(hoscode)
          if(res.code==200){
            this.hospitalInfo=res.data
          }
        },
        // 获取科室
        async getDepartment(hoscode:string){
          let res:any=await reqDepartmentDetail(hoscode)
          if(res.code==200){
            this.departmentInfo=res.data
          }
        }
    },
})

export default useDetailStore;